			
var utils = {
	namespace : function(str) {
		var arr = str.split(',');
		for ( var i = 0, len = arr.length; i < len; i++) {
			// 将命名空间切成N部分, 比如mini、common等
			var arrJ = arr[i].split("."), parent = {};
			for ( var j = 0, jLen = arrJ.length; j < jLen; j++) {
				var name = arrJ[j], child = parent[name];
				j === 0 ? eval('(typeof ' + name + ')==="undefined"?(' + name
						+ '={}):"";parent=' + name)
						: (parent = parent[name] = (typeof child) === 'undefined' ? {}
								: child);
			}
			;
		}
	},
	urlReplace : function(name, param) {
		var r = param.url || location.search.substring(1), reg = new RegExp(
				"(^|&)(" + name + "=)([^&]*)"), content = !param.content ? ""
				: param.content;
		return r.replace(reg, function(a, b, c, d) {
			return !content ? "" : b + c + content
		});
	},
	showBubble : function(content) {
		var node = $("#bubble");
		node.css("opacity", 1);
		if (!node.hasClass("qb_none")) {
			node.html(content);
			return;
		}
		node.html(content).removeClass("qb_none");
		setTimeout(function() {
			node.animate({
				opacity : 0
			}, 500, "ease", function() {
				$(this).addClass("qb_none").removeAttr("style");
			});
		}, 2300);
	},
	ajaxReq : function(opt, suc, error) {
		var option = {
			type : "GET",
			url : "",
			data : "",
			dataType : "html",
			timeout : 5000
		};
		$.extend(option, opt);
		if (!error) {
			error = function() {
				utils.showBubble("请求遇到错误，请重试");
			}
		}
		$.ajax({
			type : option.type,
			url : option.url,
			data : option.data,
			dataType : option.dataType,
			success : suc,
			error : error
		});
	},
	strReplace : function(template, json) {
		var s = template;
		for ( var d in json) {
			var reg = new RegExp("{#" + d + "#}");
			s = s.replace(reg, json[d]);
		}
		return s;
	},
	validate : function(rule,hideClass) {
		var errArr = [];
		$.each(rule, function(id, item) {
			var node = $("#" + id), value = node.val() + "";
			value = value.replace(/^\s*|\s*$/g, "");
			if (node.attr("disabled")) {
				return;
			}
			var valLen = value.length;
			if (item.dByte) {
				valLen = (value.replace(/[\u0391-\uFFE5]/g, "__")).length;
			}
			if (item.required) {
				if (value == "") {
					showError(item.emptyMsg || "您输入的" + item.itemName + "不能为空",
							id);
				} else if (value != "" && !item.reg.test(value)) {
					showError(item.errMsg, id);
				} else if (item.maxLen && valLen > item.maxLen) {
					showError(item.errMsg || "您输入的" + item.itemName + "超过"
							+ item.maxLen + "个字符", id);
				} else if (item.minLen && valLen < item.minLen) {
					showError(item.errMsg || "您输入的" + item.itemName + "不足"
							+ item.minLen + "个字符", id);
				} else if ((item.minVal && value < item.minVal)
						|| (item.maxVal && value > item.maxVal)) {
					showError("请输入" + item.minVal + "-" + item.maxVal + "的数字",
							id);
				} else {
					var err = $("#" + id + "_msg");
					err.addClass(hideClass || "false");
					item.callback && eval(item.callback + "(value, err)");
				}
			} else {
				if (value != "" && !item.reg.test(value)) {
					showError(item.errMsg, id);
				} else if (item.maxLen && valLen > item.maxLen) {
					showError(item.errMsg || "您输入的" + item.itemName + "超过"
							+ item.maxLen + "个字符", id);
				} else if (value != "" && item.minLen && valLen < item.minLen) {
					showError(item.errMsg || "您输入的" + item.itemName + "不足"
							+ item.minLen + "个字符", id);
				} else {
					$("#" + id + "_msg").addClass(hideClass || "false");
				}
			}
		});
		function showError(content, name) {
			var errNode = $("#" + name + "_msg");
			errNode.removeClass(hideClass || "false").html(content);
			errArr.push(name);
		}
		if (errArr.length > 0) {
			document.getElementById(errArr[0]).focus();
			return false;
		}
		return true;
	},
	cssProperty : (function() {
		var css3 = {}, docElement = document.documentElement, mod = 'modernizr';
		return {
			injectStyle : function(rule, callback) {
				var style, ret, node, div = document.createElement('div'), body = document.body, fakeBody = body
						|| document.createElement('body');
				style = [ '&#173;', '<style id="s', mod, '">', rule, '</style>' ]
						.join('');
				div.id = mod;
				(body ? div : fakeBody).innerHTML += style;
				fakeBody.appendChild(div);
				if (!body) {
					fakeBody.style.background = "";
					docElement.appendChild(fakeBody);
				}
				ret = callback(div, rule);
				!body ? fakeBody.parentNode.removeChild(fakeBody)
						: div.parentNode.removeChild(div);
				return !!ret;
			},
			pSupport : function(pName) {
				var style = docElement.style, css3s = 'Webkit Moz O ms'
						.split(' '), cstr = pName.charAt(0).toUpperCase()
						+ pName.substr(1), //首字母转换成大写
				rstr = (cstr + ' ' + css3s.join(cstr + ' ') + cstr).split(' '), //属性都加上前缀
				result = null;
				for ( var i = 0, len = rstr.length; i < len; i++) {
					if (rstr[i] in style) {
						result = rstr[i];
						break;
					}
				}
				return result;
			},
			has3d : function() {
				var ret = !!this.pSupport('perspective');
				if (ret && 'webkitPerspective' in docElement.style) {
					this
							.injectStyle(
									'@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}',
									function(node, rule) {
										ret = node.offsetLeft === 9
												&& node.offsetHeight === 3;
									});
				}
				return ret;
			}
		};
	})()
};